package com.itheima.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.service.TrashCleanup;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
public class CleanUpTheLog {
    @Reference
    private TrashCleanup trashCleanup;
    /**
     * @program: itcast_health
     * @description:
     * @author: 李先生
     * @create: 2020-07-08 09:03
     **/
    public void clearLogJob() {
//        获取当前月份的第一天
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
        String format = simpleDateFormat.format(date);
        format += "-01";
        log.debug("f:" + format);
        trashCleanup.delLog(format);
    }

}
